package com.note.controller;

import com.note.jsoup.GetWeatherInfoTool;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * Created by XQ on 2017/6/5.
 */
@RestController
public class WeatherController {

    /**
     * 获取城市天气
     * @param cityName
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/weather/{cityName}",method = RequestMethod.GET,produces="text/html;charset=UTF-8")
    public String getWeatherInfo(@PathVariable String cityName) throws IOException {
        GetWeatherInfoTool getWeatherInfoTool = new GetWeatherInfoTool();
        return getWeatherInfoTool.getWeatherInfo(cityName);
    }

}
